home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 238_01 / init.c < prev    next >
Text File  |  1987-07-26  |  768b  |  35 lines

  1. #include <stdio.h>
  2.  
  3. extern int TEN_MS;
  4.  
  5. GRADinit()
  6. {
  7.     int count;
  8.     long curtime, time();
  9.  
  10. #ifdef JLASER
  11.     if (initjlsr()==ERROR) {
  12.         fprintf(stderr,"Unable to initialize JLASER\n");
  13.         exit(1);
  14.     }
  15. #endif
  16.     count=0;
  17.     curtime=time(NULL);
  18.     while (curtime==time(NULL));
  19.     curtime=time(NULL);
  20.     count++;
  21.     while (curtime==time(NULL)) count++;
  22.     TEN_MS=(int) (333L *count/187);   /* 333 empty loops in IBM PC takes 10ms
  23.                                      IBM PC gives a average of 187 count */
  24.  
  25. cleanup(exitcode)
  26. {
  27. #ifdef JLASER
  28.     cleanjlsr();
  29. #endif
  30.     if (exitcode)       /* if exitcode is non-zero, error exit */
  31.         exit(exitcode);
  32. }
  33.  
  34.